-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') post=AssertPost() key=post and GetSearchKey(post) or GetSearchKeyPreset(mg.request_info.query_string) or GetSearchKeyKeyword(mg.request_info.query_string) presetList=Split(edcb.GetPrivateProfile('search','list','',INI),',') if mg.get_var(post, 'save') then --区切り文字と空文字列は使えない key.preset=mg.get_var(post, 'save'):gsub(',', '_'):match('.+') or '_' key.lock=GetVarInt(post,'lock')~=0 section=key.preset..'_Search' add=true for i,v in ipairs(presetList) do if v==key.preset then --上書き edcb.WritePrivateProfile(section, nil, '', INI) key.presetId=i add=false break end end if add then --追加 key.presetId=#presetList+1 presetList[key.presetId]=key.preset edcb.WritePrivateProfile('search', 'list', table.concat(presetList, ','), INI) end edcb.WritePrivateProfile(section, 'andKey', (GetVarInt(post,'caseFlag') and 'C!{999}' or '')..(mg.get_var(post,'andKey') or ''),INI) edcb.WritePrivateProfile(section, 'notKey', mg.get_var(post,'notKey') or '',INI) edcb.WritePrivateProfile(section, 'regExpFlag', GetVarInt(post,'regExpFlag'),INI) edcb.WritePrivateProfile(section, 'titleOnlyFlag', GetVarInt(post,'titleOnlyFlag'),INI) edcb.WritePrivateProfile(section, 'aimaiFlag', GetVarInt(post,'aimaiFlag'),INI) edcb.WritePrivateProfile(section, 'notContetFlag', GetVarInt(post,'notContetFlag'),INI) edcb.WritePrivateProfile(section, 'notDateFlag', GetVarInt(post,'notDateFlag'),INI) edcb.WritePrivateProfile(section, 'freeCAFlag', GetVarInt(post,'freeCAFlag'),INI) edcb.WritePrivateProfile(section, 'chkRecEnd', GetVarInt(post,'chkRecEnd'),INI) edcb.WritePrivateProfile(section, 'chkRecDay', GetVarInt(post,'chkRecDay'),INI) edcb.WritePrivateProfile(section, 'chkRecNoService', GetVarInt(post,'chkRecNoService'),INI) edcb.WritePrivateProfile(section, 'chkDurationMin', GetVarInt(post,'chkDurationMin'),INI) edcb.WritePrivateProfile(section, 'chkDurationMax', GetVarInt(post,'chkDurationMax'),INI) edcb.WritePrivateProfile(section, 'days', GetVarInt(post,'days'),INI) edcb.WritePrivateProfile(section, 'dateList', mg.get_var(post,'dateList') or '',INI) edcb.WritePrivateProfile(section, 'lock', GetVarInt(post,'lock'),INI) for i=0,10000 do v=mg.get_var(post, 'contentList', i) if not v then break end edcb.WritePrivateProfile(section, 'contentList'..i, v,INI) end for i=0,10000 do v=mg.get_var(post, 'serviceList', i) if not v then break end edcb.WritePrivateProfile(section, 'serviceList'..i, v,INI) end elseif GetVarInt(post, 'del') then presetId=GetVarInt(post, 'del') preset=presetList[presetId] presetList[presetId]='' if presetList[#presetList]=='' then table.remove(presetList) end edcb.WritePrivateProfile((preset or '')..'_Search', nil, '', INI) edcb.WritePrivateProfile('search', 'list', table.concat(presetList, ','), INI) end edcb.htmlEscape=15 range=GetVarTimeRange(post) archive=GetVarInt(post, 'archive')==1 a=key.enabled and SearchEpg(key,range,archive) or {} ct={ title='検索', js='\n', } ct.subheader='
\n' ct.main='